﻿Imports System.Web
Imports System.IO
Imports System.Net.Mail

Public Class Contacto

    Private Sub Contacto_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        
    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim MyMailMessage As New MailMessage()
        Try
            MyMailMessage.From = New MailAddress("")
            MyMailMessage.To.Add("")
            MyMailMessage.Subject = "Contacto desde el Lanzador" & " " & TextBox2.Text
            MyMailMessage.Body = TextBox3.Text
            Dim SMTP As New SmtpClient("smtp.gmail.com")
            SMTP.Port = 587
            SMTP.EnableSsl = True
            SMTP.Credentials = New System.Net.NetworkCredential("", "")
            If TextBox2.Text = "" Then
                MessageBox.Show("Debes escribir un asunto")
            Else
                SMTP.Send(MyMailMessage)
                MsgBox("Tu correo se ha enviado correctamente, en breve nos pondremos en contacto contigo")
                TextBox2.Clear()
                TextBox3.Clear()
                Me.Close()
            End If
        Catch ex As Exception
            MsgBox("Ha habido algun problema y tu correo no ha sido enviado.")
            Me.Close()
        End Try
    End Sub
End Class
